#include "../include/FireworkBall.h"

#include <random>

#include "../include/utilities.h"

void FireworkBall::initFireworkParticles() {
	
	std::uniform_int_distribution<> alphaCountDis(10, 30);
	int alphaCountRandom = alphaCountDis(m_gen);
	std::uniform_int_distribution<> betaCountDis(10, 30);
	int betaCountRandom = betaCountDis(m_gen);
	std::vector<Vector3> ballPointPosList = getBallPos(m_pos, 1, alphaCountRandom, betaCountRandom);
	std::normal_distribution<float> speedDis(30, 5);
	float initSpeed = fabsf(speedDis(m_gen));
	std::vector<Vector3> speedList = getSpeedlistFromPoslist(m_pos, initSpeed, ballPointPosList);
	
	std::uniform_int_distribution<> lengthDis(1, 3);
	float lengthBomb = lengthDis(m_gen);
	Color color = getRandomColor();
	addNewBombs(m_pos, speedList, color, lengthBomb);
	
	float speedRatio = 0.7;
	while (isToDo(0.5)) {
		color = getRandomColor();
		initSpeed = initSpeed * speedRatio;
		alphaCountRandom = alphaCountDis(m_gen);
		int betaCountRandom = betaCountDis(m_gen);
		ballPointPosList = getBallPos(m_pos, 1, alphaCountRandom, betaCountRandom);
		speedList = getSpeedlistFromPoslist(m_pos, initSpeed, ballPointPosList);
		addNewBombs(m_pos, speedList, color, lengthBomb);
	}
}
